<!DOCTYPE html>
<html>
    <head>
        <title>zenTXT</title>
        <meta name="description" content="zenTXT is an online text editor with complete revision history">
        <style type="text/css">
            body { margin: 0px; background-color: #555555; }
            textarea { resize: none; width: 98%; height: 98%; position: absolute; top: 0px; border: 0px; margin: 1%; color: #B0D1E8; background-color: transparent; }
            textarea:focus { outline: none; }
        </style>
        <script>
           function post_to_url(path, params, method) {
                method = method || "post";

                var form = document.createElement("form");

                //move the submit function to another variable
                //so that it doesn't get over written
                form._submit_function_ = form.submit;

                form.setAttribute("method", method);
                form.setAttribute("action", path);

                for(var key in params) {
                    var hiddenField = document.createElement("input");
                    hiddenField.setAttribute("type", "hidden");
                    hiddenField.setAttribute("name", key);
                    hiddenField.setAttribute("value", params[key]);

                    form.appendChild(hiddenField);
                }

                document.body.appendChild(form);
                form._submit_function_(); //call the renamed function
            }            
            function OnUnload()
            {
                post_to_url("http://localhost:8080/file?id=agpkZXZ-emVudHh0cgoLEgRGaWxlGCsM", { submit: "submit" } );
            }
            function OnLoad()
            {
                //document.myform.zen_text.focus();
                document.getElementById('zen_text').focus();
                //document.getElementById('zen_text').select();
            }
        </script>
    </head>
    <body onbeforeunload="OnUnload()" onload="OnLoad()">
        <!--script>
            window.onbeforeunload=function(e){
                post_to_url("http://localhost:8080/file?id=agpkZXZ-emVudHh0cgoLEgRGaWxlGCsM", { submit: "submit" } );
            };
        </script-->
        <textarea id="zen_text" cols="1" rows="1" id="textarea">Hello World!</textarea>

        <!--section id="editable" contenteditable="true">
            <h2>Go ahead, edit away!</h2>
            <p>Here's a typical paragraph element</p>
            <ol>
            <li>and now a list</li>
            <li>with only</li>
            <li>three items</li>
            </ol>
        </section-->

    </body>
</html>
